Remove initial unicode check (issues problems with piped statements).
authoroliskoli <oliskoli>
Fri, 5 Sep 2008 20:18:12 +0000 (20:18 +0000)
committeroliskoli <oliskoli>
Fri, 5 Sep 2008 20:18:12 +0000 (20:18 +0000)
Now unicode header will be detected within 'gbfgetstr'.

26 files changed:
arcdist.c
compegps.c
cst.c
csv_util.c
g7towin.c
garmin_txt.c
gbfile.c
gbfile.h
gopal.c
gpsutil.c
igc.c
main.c
netstumbler.c
nmea.c
nmn4.c
overlay.c
ozi.c
pcx.c
polygon.c
stmsdf.c
stmwpp.c
tiger.c
tmpro.c
unicsv.c
xcsv.c
xmlgeneric.c

index 3b9a8764060da24300b586d916b1481648b3d594..ecbc75db2ebe4625dd388eaeaea61e9354a37586 100644 (file)
--- a/arcdist.c
+++ b/arcdist.c
@@ -63,7 +63,6 @@ arcdist_process(void)
        gbfile *file_in;
 
        file_in = gbfopen(arcfileopt, "r", MYNAME);
-       (void) gbfunicode(file_in);     /* check for unicode text file */
        
         lat1 = lon1 = lat2 = lon2 = BADVAL;
        while ((line = gbfgetstr(file_in))) {
index e33793ab967c26d2eccf0457076a2205ad1c997c..cc4b2f90da1f6561f28a27b34d814ec435358205 100644 (file)
@@ -335,7 +335,6 @@ static void
 compegps_rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        input_datum = DATUM_WGS84;
 }
 
@@ -360,7 +359,7 @@ compegps_data_read(void)
                char *cin = buff;
                char *ctail;
                
-               line++;
+               if ((line++ == 0) && fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
                cin = lrtrim(buff);
                if (strlen(cin) == 0) continue;
                
diff --git a/cst.c b/cst.c
index e22d43cc603641d6fbd12946a7fdb4535810378e..e58421b12d9ffe4265393577bf8f24d18fb1547d 100644 (file)
--- a/cst.c
+++ b/cst.c
@@ -139,7 +139,6 @@ static void
 cst_rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        temp_route = NULL;
 }
 
@@ -169,7 +168,7 @@ cst_data_read(void)
        {
                char *cin = buff;
                
-               line++;
+               if ((line++ == 0) && fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
                cin = lrtrim(buff);
                if (strlen(cin) == 0) continue;
                
index 6a83ed70db588390b2ce6b5106bf1d42b14f6178..77a50024ca94d874fbb373d08ea3f1d664b7c4f5 100644 (file)
@@ -1258,6 +1258,8 @@ xcsv_data_read(void)
     }
 
     while ((buff = gbfgetstr(xcsv_file.xcsvfp))) {
+       if ((linecount == 0) && xcsv_file.xcsvfp->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
+
         linecount++;
        /* Whack trailing space; leading space may matter if our field sep
         * is whitespace and we have leading whitespace. 
index acf7cebe1d7d0c8f5838f216aaf47b16aafa8c1f..628d5a30313866262fcdff934f14ed7600c2d86c 100644 (file)
--- a/g7towin.c
+++ b/g7towin.c
@@ -361,7 +361,6 @@ static void
 rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        
        gardown = 1;
        mode = wptdata;
@@ -390,7 +389,7 @@ data_read(void)
                char *cin = buff;
                char *cdata;
                
-               line++;
+               if ((line++ == 0) && fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
                
                cin = lrtrim(buff);
                if (!*cin) continue;
index 8ebe8df43385a27c3020031f5e617167d1c8e2af..99748e96c2eec0094dc7c6bf2f76db6e2e5e758c 100644 (file)
@@ -1213,7 +1213,6 @@ garmin_txt_rd_init(const char *fname)
        memset(&gtxt_flags, 0, sizeof(gtxt_flags));
        
        fin = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        memset(&header_ct, 0, sizeof(header_ct));
 
        datum_index = -1;
@@ -1244,7 +1243,8 @@ garmin_txt_read(void)
        while ((buff = gbfgetstr(fin))) {
                char *cin;
                
-               current_line++;
+               if ((current_line++ == 0) && fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
+
                cin = lrtrim(buff);
                if (*cin == '\0') continue;
 
index 83a87dd737cdde4467b14ffd1da22193e1faff7b..bf450791b076d4b17258128542210bcf661319a8 100644 (file)
--- a/gbfile.c
+++ b/gbfile.c
@@ -804,7 +804,7 @@ gbfgetstr(gbfile *file)
        if (file->unicode) return gbfgetucs2str(file);
        
        for (;;) {
-               char c = gbfgetc(file);
+               int c = gbfgetc(file);
                
                if ((c == EOF) || (c == 0x1A)) {
                        if (len == 0) {
@@ -821,11 +821,32 @@ gbfgetstr(gbfile *file)
                else if (c == '\n') {
                        break;
                }
+               else if (((c == 0xFE) || (c == 0xFF)) && (! file->unicode_checked)) {
+                       int cx;
+                       int c1 = gbfgetc(file);
+                       if (c1 != EOF) {
+                               cx = c | (c1 << 8);
+                               if (cx == 0xFEFF) {
+                                       file->unicode = 1;
+                                       file->big_endian = 0;
+                                       return gbfgetucs2str(file);
+                               }
+                               else if (cx == 0xFFFE) {
+                                       file->unicode = 1;
+                                       file->big_endian = 1;
+                                       return gbfgetucs2str(file);
+                               }
+                               else gbfungetc(c1, file);
+                       }
+               }
+               
+               file->unicode_checked = 1;
+               
                if (len == file->linesz) {
                        file->linesz += 64;
                        result = file->line = xrealloc(file->line, file->linesz + 1);
                }
-               result[len] = c;
+               result[len] = (char)c;
                len++;
        }
        result[len] = '\0';     // terminate resulting string
@@ -929,38 +950,5 @@ gbfputpstr(const char *s, gbfile *file)
        return (len + 1);
 }
 
-int
-gbfunicode(gbfile *file)
-{
-       if (! file->unicode_checked) {
-               int c;
-               size_t pos;
-               
-               file->unicode_checked = 1;
-               
-               pos = gbftell(file);
-               gbfrewind(file);
-
-               c = gbfgetc(file);
-               if (c == EOF) return 0;
-               
-               if ((c != 0xFE) && (c != 0xFF)) {
-                       if (pos) gbfseek(file, pos, SEEK_SET);
-                       return 0;
-               }
-               c = c | (gbfgetc(file) << 8);
-               
-               if (c == 0xFEFF) file->big_endian = 0;
-               else if (c == 0xFFFE) file->big_endian = 1;
-               else {
-                       if (pos) gbfseek(file, pos, SEEK_SET);
-                       return 0;
-               }
-               file->unicode = 1;
-               if (pos != 0) gbfseek(file, pos, SEEK_SET);
-       }
-       return file->unicode;
-}
-
 
 /* Thats all, sorry. */
index 662282ad92a5aac03861f297c8cecc43c8cf252a..d13e24a058c806bb14d62c122d9948151409d56e 100644 (file)
--- a/gbfile.h
+++ b/gbfile.h
@@ -100,5 +100,4 @@ int gbfputflt(const float f, gbfile *file); // write a float value
 int gbfputcstr(const char *s, gbfile *file);   // write string including '\0'
 int gbfputpstr(const char *s, gbfile *file);   // write as pascal string
 
-int gbfunicode(gbfile *file);
 #endif
diff --git a/gopal.c b/gopal.c
index 89175e265c5c39bb6823a13c540de5dded1b54f5..2cdd43a696ddf078afa166e63d9d9d3f50888d39 100644 (file)
--- a/gopal.c
+++ b/gopal.c
@@ -126,7 +126,6 @@ gopal_rd_init(const char *fname)
        if (global_opts.debug_level > 1) fprintf(stderr,"setting minspeed to %5.1lf km/h and maxspeed to %5.1lf km/h\n",minspeed,maxspeed);
 
        fin = gbfopen(fname, "r", MYNAME);
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
 
        memset(buff,0,sizeof(buff));
        if (optdate)
@@ -195,6 +194,8 @@ gopal_read(void)
        line=0;
        while ((buff = gbfgetstr(fin)))
        {
+               if ((line == 0) && fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
+
                str = buff = lrtrim(buff);
                if (*buff == '\0') continue;    
                if (gopal_check_line(buff)!=8)continue;
index ccd59c1631ab94c8f86ccab41b85152c34021664..71e88dedc004290a3eb7ecc543d8a33c90b8225d 100644 (file)
--- a/gpsutil.c
+++ b/gpsutil.c
@@ -30,7 +30,6 @@ static void
 rd_init(const char *fname)
 {
        file_in = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void
@@ -65,7 +64,7 @@ data_read(void)
        char alttype;
        char icon[3];
        waypoint *wpt_tmp;
-
+       int line = 0;
        /*
         * Make sure that all waypoints in single read have same 
         * timestamp.
@@ -76,6 +75,9 @@ data_read(void)
        while ((ibuf = gbfgetstr(file_in))) {
                int n, len;
                char *sn;
+
+               if ((line++ == 0) && file_in->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
+
        /*  A sharp in column zero or an blank line is a comment */
                ibuf = lrtrim(ibuf);
                len = strlen(ibuf);
diff --git a/igc.c b/igc.c
index 64738509cf85c63cb3cb4cc41f2a457f7e847601..3fa95d518cc0b73701364f81fa32138e1eeb10f2 100644 (file)
--- a/igc.c
+++ b/igc.c
@@ -30,6 +30,7 @@ static gbfile *file_in, *file_out;
 static char manufacturer[4];
 static const route_head *head;
 static char *timeadj = NULL;
+static int lineno;
 
 #define MYNAME "IGC"
 #define MAXRECLEN 79           // Includes null terminator and CR/LF
@@ -93,6 +94,7 @@ static igc_rec_type_t get_record(char **rec)
     char *c;
 retry:
     *rec = c = gbfgetstr(file_in);
+    if ((lineno++ == 0) && file_in->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
     if (c == NULL) return rec_none;
 
     len = strlen(c);
@@ -112,8 +114,7 @@ static void rd_init(const char *fname)
     char *ibuf;
 
     file_in = gbfopen(fname, "r", MYNAME);
-    if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
-
+    lineno = 0;
     // File must begin with a manufacturer/ID record
     if (get_record(&ibuf) != rec_manuf_id || sscanf(ibuf, "A%3[A-Z]", manufacturer) != 1) {
        fatal(MYNAME ": %s is not an IGC file\n", fname);
diff --git a/main.c b/main.c
index 9109e67f719ef6cafc221ade54385f5d4c1070fd..6b0a2d99e7a8b8932530788425796b2253757fad 100644 (file)
--- a/main.c
+++ b/main.c
@@ -84,7 +84,6 @@ load_args(const char *filename, int *argc, char **argv[])
        char **argv2;
        
        fin = gbfopen(filename, "r", "main");
-       (void) gbfunicode(fin); /* check for unicode text file */
        while ((str = gbfgetstr(fin))) {
                str = lrtrim(str);
                if ((*str == '\0') || (*str == '#')) continue;
index f92d461ce8ecf4d9a53fe1c10e3dca23e7b1bc71..be29aca035ffa64f517bf6da6abcc68aa586a8ba 100644 (file)
@@ -55,7 +55,6 @@ static void
 rd_init(const char *fname)
 {
        file_in = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
        macstumbler = 0;
 }
 
@@ -79,6 +78,7 @@ data_read(void)
        long flags = 0;
        int speed = 0, channel = 0;
        struct tm tm;
+       int line = 0;
        
        memset(&tm, 0, sizeof(tm));
 
@@ -86,6 +86,7 @@ data_read(void)
                char *field;
                int field_num, len, i, stealth = 0;
                
+               if ((line++ == 0) && file_in->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
                ibuf = lrtrim(ibuf);
         /* A sharp in column zero might be a comment.  Or it might be
          * something useful, like the date.
diff --git a/nmea.c b/nmea.c
index 6c28121dd31a7412a5b095e2a84158fe11d6fb56..85ad6bfc56b3a4a05c846540a97a263c063fe058 100644 (file)
--- a/nmea.c
+++ b/nmea.c
@@ -287,7 +287,6 @@ nmea_rd_init(const char *fname)
 
        read_mode = rm_file;
        file_in = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static  void
@@ -987,6 +986,8 @@ nmea_read(void)
                
                line++;
                
+               if ((line == 0) & file_in->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
+
                if ((line == 0) && (case_ignore_strncmp(ibuf, "@SonyGPS/ver", 12) == 0)) {
                        /* special hack for Sony GPS-CS1 files:
                           they are fully (?) nmea compatible, but come with a header line like
diff --git a/nmn4.c b/nmn4.c
index 470c932baebb3ff20b0f70b4dbf69873735d5265..bb02c00be939ae9b1dd02cfaec10f8d498d4e99e 100644 (file)
--- a/nmn4.c
+++ b/nmn4.c
@@ -101,6 +101,7 @@ nmn4_read_data(void)
        char *buff;
        char *str, *c;
        int column;
+       int line = 0;
 
        char *zip1, *zip2, *city, *street, *number;     
        route_head *route;
@@ -111,6 +112,7 @@ nmn4_read_data(void)
        
        while ((buff = gbfgetstr(fin)))
        {
+               if ((line++ == 0) && fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
                str = buff = lrtrim(buff);
                if (*buff == '\0') continue;
                
@@ -273,7 +275,6 @@ static void
 nmn4_rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void
index 3c96f40a103ae521486b95cb3edc3dc1e6e2fd96..20b92674c97eaf84bf96a293cfa70132266f651f 100644 (file)
--- a/overlay.c
+++ b/overlay.c
@@ -153,7 +153,6 @@ static
 void ovl_rd_init(char const *fname)
 {
   fpin = gbfopen(fname, "r", MYNAME);
-       if (gbfunicode(fpin)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 #define SECTION_NONE    0
@@ -228,6 +227,7 @@ static void ovl_read(void)
   route_head *route_head = NULL;
   waypoint   *wpt;
   int      sym_cnt;
+  int lineno = 0;
 
   groups = NULL;
   groups_cnt = 0;
@@ -240,6 +240,8 @@ static void ovl_read(void)
   isSection = SECTION_NONE;
   while ((line = gbfgetstr(fpin)))
   {
+    if ((lineno == 0) && fpin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
+    lineno++;
     line = lrtrim(line);
     if( (pstr = strstr(line,"[Symbol "))!= NULL)
     {
diff --git a/ozi.c b/ozi.c
index cb953f43ff7858e6012fdc1d0287c057e110b2e3..04ebf4afff7b7b5a4f0a56e9b53d29b99b05ded9 100644 (file)
--- a/ozi.c
+++ b/ozi.c
@@ -394,7 +394,6 @@ static void
 rd_init(const char *fname)
 {
     file_in = gbfopen(fname, "rb", MYNAME);
-    if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 
     mkshort_handle = mkshort_new_handle();
     ozi_init_units(0);
@@ -682,7 +681,8 @@ data_read(void)
     int linecount = 0;
     
     while ((buff = gbfgetstr(file_in))) {
-        linecount++;
+
+        if ((linecount++ == 0) && file_in->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
 
         /* 
          * this is particularly nasty.  use the first line of the file
diff --git a/pcx.c b/pcx.c
index 37ced9f210f5c0ec98fd3c66074020921e62ba92..6a4437b9769f94a584addf1d461c775c37634d7a 100644 (file)
--- a/pcx.c
+++ b/pcx.c
@@ -54,7 +54,6 @@ static void
 rd_init(const char *fname)
 {
        file_in = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void
@@ -99,6 +98,7 @@ data_read(void)
        char tbuf[20];
        char nbuf[20];
        int points;
+       int line = 0;
 
        read_as_degrees  = 0;
        points = 0;
@@ -108,6 +108,8 @@ data_read(void)
                char *ibuf = lrtrim(buff);
                char *cp;
                
+               if ((line++ == 0) && file_in->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
+
                switch (ibuf[0]) {
                case 'W': 
                        time[0] = 0;
index 5a3d3a2eb1f1d7d48032727d4b04b28c4f2c5af3..5f2abce188ad53ddf8321b08105c2bcb73305150 100644 (file)
--- a/polygon.c
+++ b/polygon.c
@@ -259,7 +259,6 @@ polygon_process(void)
        gbfile *file_in;
 
        file_in = gbfopen(polyfileopt, "r", MYNAME);
-       (void) gbfunicode(file_in);     /* check for unicode text file */
        
         olat = olon = lat1 = lon1 = lat2 = lon2 = BADVAL;
        while ((line = gbfgetstr(file_in))) {
index 3c0f7ebb98831b92c30948367dc32c6fb607773c..db9881303e9017030a3c19661df80f322b55724c 100644 (file)
--- a/stmsdf.c
+++ b/stmsdf.c
@@ -336,7 +336,6 @@ static void
 rd_init(const char *fname)
 {
        fin = gbfopen(fname, "r", MYNAME);
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        
        lineno = 0;
        route = NULL;
@@ -364,7 +363,7 @@ data_read(void)
        while ((buf = gbfgetstr(fin)))
        {
                char *cin = lrtrim(buf);
-               lineno++;
+               if ((lineno++ == 0) && fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
                
                if (*cin == '\0') continue;
                
index 762fe21ce5081abdb9b2896ab382c70ef4fbd2fb..14be1f68339522fcdfd1ad135f437632f63fce00 100644 (file)
--- a/stmwpp.c
+++ b/stmwpp.c
@@ -61,7 +61,6 @@ static void
 stmwpp_rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        track = NULL;
        route = NULL;
        wpt = NULL;
@@ -77,6 +76,7 @@ static void
 stmwpp_data_read(void)
 {
        char *buff;
+       int line = 0;
        
        what = STM_NOTHING;
        buff = gbfgetstr(fin);
@@ -91,6 +91,8 @@ stmwpp_data_read(void)
                int column = -1;
                struct tm time;
                
+               if ((line++ == 0) && fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
+
                buff = lrtrim(buff);
                if (*buff == '\0') continue;
                
diff --git a/tiger.c b/tiger.c
index f8f4b20406590417b79e793f51fb5cbeb15bef16..e06c6212e975a3b8c6ee051c4897aa3b9ba471f3 100644 (file)
--- a/tiger.c
+++ b/tiger.c
@@ -99,7 +99,6 @@ static void
 rd_init(const char *fname)
 {
        file_in = gbfopen(fname, "rb", MYNAME);
-       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
        mkshort_handle = mkshort_new_handle();
 }
 
@@ -131,8 +130,10 @@ data_read(void)
        char icon[100];
        char *ibuf;
        waypoint *wpt_tmp;
+       int line = 0;
        
        while ((ibuf = gbfgetstr(file_in))) {
+               if ((line++ == 0) && file_in->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
                if( sscanf(ibuf, "%lf,%lf:%100[^:]:%100[^\n]", 
                                &lon, &lat, icon, desc)) {
                        wpt_tmp = waypt_new();
diff --git a/tmpro.c b/tmpro.c
index 8028123ac854dbf32c8e988f187c510f9ba53938..c46899602f6ef1a7b8f85c8e48e69ae293baf211 100644 (file)
--- a/tmpro.c
+++ b/tmpro.c
@@ -45,7 +45,6 @@ static void
 rd_init(const char *fname)
 {
     file_in = gbfopen(fname, "rb", MYNAME);
-    if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void 
@@ -77,7 +76,7 @@ data_read(void)
     int linecount = 0;
     
     while ((buff = gbfgetstr(file_in))) {
-        linecount++;
+        if ((linecount++ == 0) && file_in->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
 
        /* skip the line if it contains "sHyperLink" as it is a header (I hope :) */
        if ((strlen(buff)) && (strstr(buff, "sHyperLink") == NULL)) {
index 15cc6d9ffceefcdfd6ceb62a6dd3c1fb4925617f..fc160664b600ebd247bdd6f5edc17cab84dc80d3 100644 (file)
--- a/unicsv.c
+++ b/unicsv.c
@@ -573,12 +573,11 @@ unicsv_rd_init(const char *fname)
 
        fin = gbfopen(fname, "rb", MYNAME);
        
-       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
-
        if ((c = gbfgetstr(fin)))
                unicsv_fondle_header(c);
        else
                unicsv_fieldsep = NULL;
+       if (fin->unicode) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void
diff --git a/xcsv.c b/xcsv.c
index 10e64862e16ff4e2ecca34d853cf55453dab6729..b72a26761133927e2ac5a93701baabb6f1f54d12 100644 (file)
--- a/xcsv.c
+++ b/xcsv.c
@@ -473,7 +473,6 @@ xcsv_read_style(const char *fname)
     xcsv_file_init();
 
     fp = gbfopen(fname, "rb", MYNAME);
-    (void) gbfunicode(fp);
     while ((sbuff = gbfgetstr(fp))) {
         sbuff = lrtrim(sbuff);
        xcsv_parse_style_line(sbuff);
@@ -546,7 +545,6 @@ xcsv_rd_init(const char *fname)
     }
 
     xcsv_file.xcsvfp = gbfopen(fname, "r", MYNAME);
-    if (gbfunicode(xcsv_file.xcsvfp)) cet_convert_init(CET_CHARSET_UTF8, 1);
     xcsv_file.gps_datum = GPS_Lookup_Datum_Index(opt_datum);
     is_fatal(xcsv_file.gps_datum < 0, MYNAME ": datum \"%s\" is not supported.", opt_datum);
 }
index 6f82f2261f9a9b7464242cee1fa6740284adf54b..6fd18c0fcc031d5d6cc11832e868e57dcd207c7e 100644 (file)
@@ -315,7 +315,6 @@ xml_init0(const char *fname, xg_tag_mapping *tbl, const char *encoding,
 {
        if (fname) {
                ifd = gbfopen(fname, "r", MYNAME);
-               (void) gbfunicode(ifd);
                if (offset) {
                        gbfseek(ifd, offset, SEEK_SET);
                }